/**
 * @frame.h
 * This file is part of FEGRF.
 * 
 * FEGRF is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * See LICENSE file in main folder for more information.
 */

#ifndef __FRAME_H__
#define __FRAME_H__

#include "main.h"

enum OtherID
{
	EXTRACT_WITH_DIRECTORY = 1 << 0,
	EXTRACT_CONVERT_ASCII  = 1 << 1,
	INSERT_GRF = 1,
	INSERT_DIR = 2,
	RADIOBTN_ENCODE = 3,
	RADIOBTN_REPACK = 4,
	MENU_SAVE = 1,
	MENU_SAVE_AS = 2,
};

class ImageCanvas : public wxScrolledWindow
{
public:
	ImageCanvas(wxWindow *parent);

	wxImage m_image;

	void OnPaint(wxPaintEvent &WXUNUSED(event));
	DECLARE_EVENT_TABLE()
};

class GRFFrame : public wxFrame
{
	ImageCanvas *m_canvas;
	wxToolBar *m_toolbar;
	wxTextCtrl *m_text;
public:
	GRFFrame(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size);
	~GRFFrame();
	SprFile *m_spr;
	int m_index;
	GrfNode *m_node;

	void ShowToolbar(const int flag);
	void OnSave(wxCommandEvent &event);
	void OnSaveAs(wxCommandEvent &event);
	void OnClose(wxCommandEvent &event);
	void OnBack(wxCommandEvent &event);
	void OnNext(wxCommandEvent &event);
	void OnResize(wxSizeEvent &event);
	void OnKeyPressed(wxKeyEvent &event);
	void SetText(wxString&);
	void SetImage(wxImage image);
	void SetSprite(SprFile *spr_file);
	DECLARE_EVENT_TABLE()
};

class GRFDialog : public wxDialog
{
public:
	GRFDialog(wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos, const wxSize &size);

	void AddList(wxArrayString string);
	void OnCancel(wxCommandEvent &event);
	void OnExtract(wxCommandEvent &event);
	void OnInsertGRF(wxCommandEvent &event);
	void OnInsertDIR(wxCommandEvent &event);
	void OnSetting(wxCommandEvent &event);
	void OnCloseWindow(wxCloseEvent &event);
private:
	wxListBox *m_listbox;
	wxBoxSizer *m_sizer;
	wxButton *m_btn_ok;
	wxButton *m_btn_cancel;
	wxCheckBox *m_checkbox_dir;
	wxCheckBox *m_checkbox_ascii;
	wxButton *m_load_dir;
	wxButton *m_load_grf;
	wxRadioButton *m_radiobtn_fast;
	wxRadioButton *m_radiobtn_decrypt;
	wxRadioButton *m_radiobtn_recompress;
	wxRadioButton *m_radiobtn_ansi;
	wxRadioButton *m_radiobtn_euc_kr;
	wxRadioButton *m_radiobtn_local;
	wxSlider *m_slider_complevel;

	DECLARE_EVENT_TABLE()
};

#endif //__FRAME_H__